<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="HeaderInfo">
using System;
using System.Collections.Generic;
using System.Text;

namespace <xsl:value-of select="ProjectName"/>.Core.Domain
{


<![CDATA[    
    /// <summary>
    /// The base class for the data access objects.
    /// </summary>
    /// <typeparam name="ObjectIdType">The type of the objectId</typeparam>
    public abstract class DomainObject<ObjectIdType>
    {


        #region Properties


        /// <summary>
        /// The unique identifier for the domainobject (id field)
        /// </summary>
        public virtual ObjectIdType ObjectId
        {
            get { return _objectId; }
            protected set { _objectId = value; }
        }


        /// <summary>
        /// DateTime for the object, provides atomic
        /// operations (see stale object exception)
        /// </summary>
        public virtual DateTime Modified
        {
            get { return _modified; }
            set { _modified = value; }
        }

        #endregion


        #region Fields

        // Assigns a default value to Type see
        // http://msdn2.microsoft.com/en-us/library/xwth0h0d(vs.80).aspx
        private ObjectIdType _objectId = default ( ObjectIdType );
       
        private DateTime _modified = DateTime.Now;



        #endregion




        /// <summary>
        /// Provides the implementation for comparing this object
        /// with others.
        /// </summary>
        /// <param name="obj">Object to compare to, must be DomainObject&lt;Type&gt;</param>
        /// <returns>true if comparison</returns>
        public override sealed bool Equals ( object obj )
        {

            DomainObject<ObjectIdType> compare = obj as DomainObject<ObjectIdType>;

            // Compare is either null or not a domain object
            if ( compare == null )
            {
                return false;
            }

            // This of the comparison object does not have an id
            if ( ( compare.ObjectId == null || this.ObjectId == null ||
                compare.ObjectId.Equals ( default ( ObjectIdType ) ) )
                || this.ObjectId.Equals ( default ( ObjectIdType ) ) )
            {
                return false;
            }


            // else compare the two objects
            return this.GetHashCode ( ).Equals ( compare.GetHashCode ( ) );
        }



        /// <summary>
        /// Force implementors to build a comparison utility
        /// </summary>
        public abstract override int GetHashCode ( );




    }

]]>
}
	
	
	
	
	
	</xsl:template>
	
	
	
</xsl:stylesheet>